package com.suxg.hbase.utils;

import org.springframework.lang.Nullable;

public class ValiteUtils2 {

	public static void main(String[] args) {
//		testCheckBT();
		
		checkBtOb("123");
		
	}

	/**
	 * 测试多个必填参数
	 */
	public static void testCheckBT() {
		
		if (checkBtIsEmptys("")) {
			System.out.println("参数为空1");
		}

		if (checkBtIsEmptys("123", "")) {
			System.out.println("参数为空2");
		}

		if (checkBtIsEmptys("123", "456", "")) {
			System.out.println("参数为空3");
		}
		if (checkBtIsEmptys("123", "456", "789", " ")) {
			System.out.println("参数为空4");
		}

		if (checkBtIsEmptys("123", "456", "789")) {
			System.out.println("参数为空5");
		}
	}

	public static boolean checkBtOb(Object s) {
		boolean flag = false;
		  
		if (s instanceof Integer) {
            System.out.println("is Integer");
        } else if (s instanceof Long) {
            System.out.println("is Long");
        } else if (s instanceof Short) {
            System.out.println("is Short");
        } else if (s instanceof Boolean) {
            System.out.println("is Boolean");
        } else if (s instanceof Byte) {
            System.out.println("is byte");
        } else if (s instanceof Character) {
            System.out.println("is Character");
        } else if (s instanceof Double) {
            System.out.println("is Double");
        } else if (s instanceof Float) {
            System.out.println("is Float");
        } else if (s instanceof String) {
            System.out.println("is String");
        } else {
            System.out.println("unknown type, or yourself type");
        }

		return flag;

	}

	/**
	 * 校验必填参数
	 */
	public static boolean checkBtIsEmptys(String... s) {
		boolean flag = false;
//		if(s.getClass().gett)
		for (int i = 0; i < s.length; i++) {
			flag = isEmpty(s[i]);
			if (flag) {
				break;
			}
		}

		return flag;
	}

	public static boolean isEmpty(@Nullable Object str) {
		return (str == null || "".equals(str) || " ".equals(str));
	}
}
